#!/bin/bash

# Get battery percentage
battery=$(acpi -b | grep -oP '[0-9]+(?=%)')

# Check if charging
charging=$(acpi -b | grep -q 'Charging' && echo "true" || echo "false")

# Determine the glyph based on battery percentage
if [ "$charging" = "true" ]; then
    echo "󰂄"  # Charging
elif [ "$battery" -lt 10 ]; then
    echo "󰂃"  # Battery < 10%
elif [ "$battery" -lt 20 ]; then
    echo "󰁺"  # Battery ≥ 10% and < 20%
elif [ "$battery" -lt 30 ]; then
    echo "󰁻"  # Battery ≥ 20% and < 30%
elif [ "$battery" -lt 40 ]; then
    echo "󰁼"  # Battery ≥ 30% and < 40%
elif [ "$battery" -lt 50 ]; then
    echo "󰁼"  # Battery ≥ 40% and < 50%
elif [ "$battery" -lt 60 ]; then
    echo "󰁾"  # Battery ≥ 50% and < 60%
elif [ "$battery" -lt 70 ]; then
    echo "󰁿"  # Battery ≥ 60% and < 70%
elif [ "$battery" -lt 80 ]; then
    echo "󰂀"  # Battery ≥ 70% and < 80%
elif [ "$battery" -lt 90 ]; then
    echo "󰂁"  # Battery ≥ 80% and < 90%
else
    echo "󰂂"  # Battery ≥ 90% and < 100%
fi

